"""
class Phone:

    __current = 0.5

    def __cpu_core(self):
        print("cpu以单核模式运行")

    def call_by_5g(self):
        if self.__current >= 5:
            print("5g通话已开启")
        else:
            self.__cpu_core()
            print("电量不足，cpu单核模式已开启")


phone = Phone()
phone.call_by_5g()
"""


#  封装
class Phone:
    __is_5g_enable = False

    def __check_5g(self):
        if self.__is_5g_enable:
            print("5g开启")
        else:
            print("5g关闭")

    def call_bu_5g(self):
        self.__check_5g()
        print("正在通话中")


#  继承 单继承 多继承


class Phone2022:

    def callby_5g(self):
        print("2022新功能，5G通话")


phone2 = Phone2022()

phone2.callby_5g()


class NFC:

    def read_card(self):
        print("读取nfc")

    def write_card(self):
        print("写入nfc")


class RemoteControl:

    def remote_control(self):
        print("红外遥控开启")


class Phone2023(Phone, Phone2022, NFC, RemoteControl):
    pass


phone3 = Phone2023()
phone3.remote_control()
phone3.read_card()


#  子类复写 继承后可以直接复写
class Phone1:
    producer = "华为"
    id = "001"

    def call(self):
        print("5g通话开启")


class Phone2(Phone1):
    producer = "小米"
    id = "002"

    def call(self):
        print("开启时cpu位单核模式")
        Phone1.call(self)
        print(f"父类手机厂商是，{Phone1.producer}")
        print(super().producer)
        super().call()
        print("省电模式")


print(Phone2.producer)
phone2 = Phone2()
phone2.call()
